projects
/
emacs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
866f527
)
Check validity of rx submatch-n number
author
Mattias Engdegård
<mattiase@acm.org>
Thu, 7 Feb 2019 18:05:06 +0000
(19:05 +0100)
committer
Mattias Engdegård
<mattiase@acm.org>
Sun, 23 Jun 2019 18:31:48 +0000
(20:31 +0200)
* lisp/emacs-lisp/rx.el (rx-submatch): Type and range check (Bug#34373).
lisp/emacs-lisp/rx.el
patch
|
blob
|
history
diff --git
a/lisp/emacs-lisp/rx.el
b/lisp/emacs-lisp/rx.el
index 8ef78fd69e6a6ed063a54db3a598cda8c93fd12b..2130e3e1aea23c919ce3dfabf981d1422abbe5ba 100644
(file)
--- a/
lisp/emacs-lisp/rx.el
+++ b/
lisp/emacs-lisp/rx.el
@@
-725,6
+725,8
@@
FORM is either `(repeat N FORM1)' or `(repeat N M FORMS...)'."
(defun rx-submatch-n (form)
"Parse and produce code from FORM, which is `(submatch-n N ...)'."
(let ((n (nth 1 form)))
+ (unless (and (integerp n) (> n 0))
+ (error "rx `submatch-n' argument must be positive"))
(concat "\\(?" (number-to-string n) ":"
(if (= 3 (length form))
;; Only one sub-form.